<template>
  <el-dialog
    title="账单详情"
    :visible.sync="dialogVisible"
    width="1000px"
  >
    <el-table
      :data="tableData"
      border
    >
      <el-table-column type="expand">
        <template slot-scope="props">
          <div class="flex flex-wrap detail">
            <p class="detail_item">
              <label>平台手续费：</label>
              ￥{{props.row.trans.platform_amount}}（{{props.row.trans.platform_rate}}%）
            </p>
            <p class="detail_item">
              <label>实名认证：</label>
              ￥{{props.row.trans.realname_amount}}
            </p>
            <p class="detail_item">
              <label>合同：</label>
              ￥{{props.row.trans.contract_amount}}
            </p>
            <p class="detail_item">
              <label>风控：</label>
              ￥{{props.row.trans.risk_amount}}
            </p>
            <p class="detail_item">
              <label>保险：</label>
              ￥{{props.row.trans.insurance_amount}}（{{props.row.trans.insurance_rate}}%）
            </p>
            <p class="detail_item">
              <label>融资总租金：</label>
              ￥{{props.row.trans.financing_amount}}（{{props.row.trans.financing_rate}}%）
            </p>
            <p class="detail_item">
              <label>存证：</label>
              ￥{{props.row.trans.file_amount}}（{{props.row.trans.file_rate}}%）
            </p>
            <p class="detail_item">
              <label>代扣手续费：</label>
              ￥{{props.row.trans.withhold_amount}}（{{props.row.trans.withhold_rate}}%）
            </p>
            <p class="detail_item">
              <label>花呗：</label>
              ￥{{props.row.trans.huabei_fee||'0.00'}}
            </p>
          </div>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        label="编号"
        prop="id"
      >
      </el-table-column>
      <el-table-column
        align="center"
        label="付款方式"
      >
        <template slot-scope="scope">
          <span>{{scope.row.pay_type==1?'智能合同代扣':scope.row.pay_type==2?'芝麻信用':scope.row.pay_type==3?'花呗':'主动支付'}}</span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        label="付款时间"
        prop="pay_time"
      >
      </el-table-column>
      <el-table-column
        align="center"
        label="付款内容"
      >
        <template slot-scope="scope">
          <span>{{scope.row.status==3?'订单买断':scope.row.status==1?'第'+scope.row.which_period+'期账单交租':''}}</span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        label="流水号"
        prop="trade_no"
      >
      </el-table-column>
      <el-table-column
        align="center"
        label="付款金额"
      >
        <template slot-scope="scope">
          <span>{{scope.row.rent?'￥'+scope.row.rent:''}}</span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        label="结算手续费"
      >
        <template slot-scope="scope">
          <span>{{scope.row.trans.total_charge?'￥'+scope.row.trans.total_charge:''}}</span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        label="结算金额"
      >
        <template slot-scope="scope">
          <span>{{scope.row.trans.settlement_amount?'￥'+scope.row.trans.settlement_amount:''}}</span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        label="状态"
        width="80"
      >
        <template slot-scope="scope">
          <el-tag :type="scope.row.settle_type==1?'success':'warning'">{{scope.row.settle_type==1?'已结算':scope.row.settle_type==2?'拒绝计算':scope.row.settle_type==3?'已退款结算':'未结算'}}</el-tag>
        </template>
      </el-table-column>
    </el-table>
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        type="primary"
        @click="dialogVisible=false"
      >关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getLeaseInfo } from "@/api/order";
export default {
  props: ['orderId'],
  data() {
    return {
      dialogVisible: false,
      tableData: []
    };
  },
  methods: {
  },
  watch: {
    dialogVisible(val) {
      if (val) {
        getLeaseInfo(this.orderId).then(res => {
          this.tableData = res || [];
        })
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.detail {
  padding: 15px 70px 5px;
  background-color: #f8f8f8;
}
.detail_item {
  width: 33%;
  color: #999999;
  margin-bottom: 10px;
  label {
    color: #748cad;
    width: 100px;
    display: inline-block;
  }
}
/deep/.el-table__expanded-cell {
  padding: 0;
}
</style>